package gc;/** * @Author: Beating Pupils * @Date: 2020/7/28 06:41 * @Description: 模拟FullGC，新生代10M 老年代10M * 实验证明：fullGC会回收老年代 年轻代和metaspace * -XX:NewSize=10485760 -XX:MaxNewSize=10485760 -XX:InitialHeapSize=20971520 -XX:MaxHeapSize=20971520 -XX:SurvivorRatio=8 * -XX:PretenureSizeThreshold=3145728 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps * -Xloggc:fullGC.log */public class FullGC {    public static void main(String[] args) {        byte[] arr1 = new byte[5 * 1024 * 1024];        arr1=null;        byte[] arr2 = new byte[2 * 1024 * 1024];        byte[] arr3 = new byte[2 * 1024 * 1024];        byte[] arr4 = new byte[2 * 1024 * 1024];        byte[] arr6 = new byte[100 * 1024];        byte[] arr5 = new byte[2 * 1024 * 1024];    }}